home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / callbutn / global.bas < prev    next >
Encoding:
BASIC Source File  |  1995-03-13  |  9.3 KB  |  296 lines

  1.  
  2. ' Booleans
  3.  
  4. ' ====================
  5. ' BTRIEVE DECLARATIONS
  6. ' ====================
  7.  
  8.     Rem ------------- BTRIEVE error codes
  9. Global Const BE_OK = 0
  10. Global Const BE_INVALID_OP = 1
  11. Global Const BE_IO_ERROR = 2
  12. Global Const BE_FILENOTOPEN = 3
  13. Global Const BE_KEYNOTFOUND = 4
  14. Global Const BE_DUPKEY = 5
  15. Global Const BE_INVALID_KEYNUM = 6
  16. Global Const BE_DIFF_KEYNUM = 7
  17. Global Const BE_INVALID_POS = 8
  18. Global Const BE_EOF = 9
  19. Global Const BE_KEYMODIF = 10
  20. Global Const BE_INVALID_FILE = 11
  21. Global Const BE_FILENOTFOUND = 12
  22. Global Const BE_EXTENSIONFILE = 13
  23. Global Const BE_PREIMAGE_OPEN = 14
  24. Global Const BE_PREIMAGE_IO = 15
  25. Global Const BE_EXPANSION = 16
  26. Global Const BE_CLOSE = 17
  27. Global Const BE_DISKFULL = 18
  28. Global Const BE_UNRECOVERABLE = 19
  29. Global Const BE_INACTIVE = 20
  30. Global Const BE_KEYBUFF_SIZE = 21
  31. Global Const BE_DATABUFF_SIZE = 22
  32. Global Const BE_POSBLK_SIZE = 23
  33. Global Const BE_PAGE_SIZE = 24
  34. Global Const BE_CREATE = 25
  35. Global Const BE_NUM_KEYS = 26
  36. Global Const BE_INVALID_KEYPOS = 27
  37. Global Const BE_INVALID_RECLEN = 28
  38. Global Const BE_INVALID_KEYLEN = 29
  39. Global Const BE_NOT_BTRVFILE = 30
  40. Global Const BE_FILE_EXTENDED = 31
  41. Global Const BE_EXTEND_IO = 32
  42. Global Const BE_INVALID_EXTNAME = 34
  43. Global Const BE_DIRECTORY = 35
  44. Global Const BE_TRANSACTION = 36
  45. Global Const BE_TANS_ACTIVE = 37
  46. Global Const BE_TRANS_IO = 38
  47. Global Const BE_TRANS_END = 39
  48. Global Const BE_TRANS_MAXFILES = 40
  49. Global Const BE_OP_NOTALLOWED = 41
  50. Global Const BE_ACC_ACCESS = 42
  51. Global Const BE_INVALID_RECADDR = 43
  52. Global Const BE_NULL_KEY = 44
  53. Global Const BE_KEY_FLAG = 45
  54. Global Const BE_ACCESS_DENIED = 46
  55. Global Const BE_MAX_OPENFILES = 47
  56. Global Const BE_INVALID_ALTSEQ = 48
  57. Global Const BE_KEY_TYPE = 49
  58. Global Const BE_OWNER_SET = 50
  59. Global Const BE_INVALID_OWNER = 51
  60. Global Const BE_CACHE = 52
  61. Global Const BE_INVALID_INTF = 53
  62. Global Const BE_VAR_PAGE = 54
  63. Global Const BE_AUTOINCREMENT = 55
  64. Global Const BE_INCOMPLETE_INDEX = 56
  65. Global Const BE_EMS_ERROR = 57
  66. Global Const BE_COMPRBUFF_SIZE = 58
  67. Global Const BE_FILE_EXIST = 59
  68. Global Const BE_CONFLICT = 80
  69. Global Const BE_LOCK_ERROR = 81
  70. Global Const BE_LOST_POSITION = 82
  71. Global Const BE_READ_OUT_TRANS = 83
  72. Global Const BE_RECORD_LOCKED = 84
  73. Global Const BE_FILE_LOCKED = 85
  74. Global Const BE_FILE_TABLE_FULL = 86
  75. Global Const BE_OPEN_MODE = 88
  76. Global Const BE_LOCK_TYPE = 93
  77. Global Const BE_PERMISSION = 94
  78. Global Const BE_INVALID_OPCOD = 100
  79.  
  80.     ''''File attibute flag.''''
  81.     ' these are used when creating the file
  82. Global Const FF_VAR_LENGTH = 1
  83. Global Const FF_STRIP_BLANK = 2
  84. Global Const FF_PREALLOCATE = 4
  85. Global Const FF_COMPRESS = 8
  86. Global Const FF_KEYONLY = 16
  87. Global Const FF_10_FREE = 64
  88. Global Const FF_20_FREE = 128
  89. Global Const FF_30_FREE = 192
  90.  
  91.     ''''Key attribute flag.''''
  92.     ' these are used when creating the file
  93. Global Const KF_STRING = 0
  94. Global Const KF_DUPLICATE = 1
  95. Global Const KF_MODIFIABLE = 2
  96. Global Const KF_INTEGER = 4
  97. Global Const KF_NULLVALUE = 8
  98. Global Const KF_SEGMENT = 16
  99. Global Const KF_ALT_SORT = 32
  100. Global Const KF_DESCENDING = 64
  101. Global Const KF_EXTENDED = &H100
  102. Global Const KF_MANUAL = &H200
  103.  
  104.     ''''Extended key types.''''
  105. Global Const EKT_STRING = 0
  106. Global Const EKT_INTEGER = 1
  107. Global Const EKT_FLOAT = 2
  108. Global Const EKT_DATE = 3
  109. Global Const EKT_TIME = 4
  110. Global Const EKT_DECIMAL = 5
  111. Global Const EKT_MONEY = 6
  112. Global Const EKT_LOGICAL = 7
  113. Global Const EKT_NUMERIC = 8
  114. Global Const EKT_BFLOAT = 9
  115. Global Const EKT_LSTRING = 10
  116. Global Const EKT_ZSTRING = 11
  117. Global Const EKT_UINTEGER = 14
  118. Global Const EKT_AUTOINCREMENT = 15
  119.  
  120. ''------------- BTRIEVE record type definitions.-----------------------------''
  121. ' Btrieve's optional key buffer
  122. ' this is not used in this demo program
  123. ' the program can be modified to use this for Btrieve's key buffer
  124. ' instead of KeyVal
  125. Type BTRV_Key_Buffer
  126.     Kstr As String * 128
  127. End Type
  128. Global BtrvKeyBuf As BTRV_Key_Buffer
  129.  
  130. ' filespec used in creating files
  131. Type BTRV_FILESPEC
  132.     Length      As Integer
  133.     PageSize    As Integer
  134.     nbIndex     As Integer
  135.     FileFlags   As Integer
  136.     Alloc       As Integer
  137. End Type
  138.  
  139.     '''' BTRIEVE Open file modes ''''
  140.     Global Const OM_NORMAL = 0
  141.     Global Const OM_ACCELERATED = 1
  142.     Global Const OM_READONLY = 2
  143.     Global Const OM_VERIFY = 3
  144.     Global Const OM_EXCLUSIVE = 4
  145.  
  146.     '''' BTRIEVE Lock types ''''
  147.     ' note that no wait locks are not allowed in the Windows dll
  148.     Global Const LCK_NONE = 0          '' No lock.
  149.     Global Const LCK_SINGLE = 200      '' Single record lock (nowait).
  150.     Global Const LCK_MULTIPLE = 400    '' Multiple record lock (nowait).
  151.  
  152.     '''' Btrieve's Operation Codes '''
  153.     Global Const GET_FIRST = 12
  154.     Global Const GET_LAST = 13
  155.     Global Const GET_NEXT = 6
  156.     Global Const GET_PREV = 7
  157.     Global Const GET_EQ = 5
  158.     Global Const GET_GT = 8
  159.     Global Const GET_GE = 9
  160.     Global Const GET_LT = 10
  161.     Global Const GET_LE = 11
  162.  
  163.     Global Const B_OPEN = 0
  164.     Global Const B_CLOSE = 1
  165.     Global Const B_INSERT = 2
  166.     Global Const B_UPDATE = 3
  167.     Global Const B_DELETE = 4
  168.     Global Const B_CREATE = 14
  169.     Global Const B_STAT = 15
  170.     Global Const B_SETDIR = 17
  171.     Global Const B_GETDIR = 18
  172.     Global Const B_BEGTRAN = 19
  173.     Global Const B_ENDTRAN = 20
  174.     Global Const B_ABORTTRAN = 21
  175.     Global Const B_GETPOS = 22
  176.     Global Const B_GETDIRECT = 23
  177.     Global Const B_STEPNEXT = 24
  178.     Global Const B_STOP = 25
  179.     Global Const B_UNLOCK = 27
  180.     Global Const B_RESET = 28
  181.     Global Const B_STEPFIRST = 33
  182.     Global Const B_STEPLAST = 34
  183.     Global Const B_STEPPREV = 35
  184.     Global Const B_USE = 48
  185.     Global Const B_DUPS = 49
  186.     Global Const B_KEYONLY = 40
  187.  
  188.     '''' BTRIEVE Change password ''''
  189.     Global Const CP_RW_NOENCRYPT = 0     'Owner name required for Read/Write. No encryption.
  190.     Global Const CP_W_NOENCRYPT = 1      'Owner name required for Write. No encryption.
  191.     Global Const CP_RW_ENCRYPT = 2       'Owner name required for Read/Write. With encryption.
  192.     Global Const CP_W_ENCRYPT = 3        'Owner name required for Write. With encryption.
  193.     Global Const CP_CLEAR = 4            'Clear any password.
  194.  
  195.  
  196. ' WBTRCALL.DLL declarations
  197. Declare Function WBtrvInit Lib "wbtrcall.dll" (ByVal Options As String) As Integer
  198. Declare Function WBtrvStop Lib "wbtrcall.dll" () As Integer
  199. Declare Function BtrCall Lib "wbtrcall.dll" (ByVal op%, ByVal Pb$, DB As Any, Dl As Integer, ByVal Kb$, ByVal Kl%, ByVal Kn%) As Integer
  200.  
  201. Global Const MaxFile = 0                    ' the number of files we will open (0 based)
  202. Global BStatus As Integer                   ' Btrieve's return status code
  203. Global PosBlk(MaxFile) As String * 128      ' Btrieve's position blocks
  204. Global KeyVal As String                     ' key value passed to and from CallBtrv()
  205. Global FileName(MaxFile) As String          ' filenames
  206. Global Path As String                       ' path for files
  207. Global KeyLen(MaxFile, 3) As Integer        ' key length (fileno,keyno)
  208. Global FileNo As Integer                    ' our file number
  209. Global KeyNo As Integer                     ' the key number
  210.  
  211. ' Btrieve's data buffer
  212. ' it must be set to the page size or at least to the
  213. ' largest record size for your files
  214. Type BTRV_BUF
  215.     buffer  As String * 1024
  216. End Type
  217. Global BtrvBuf As BTRV_BUF
  218.  
  219. ' specifications for the sample data file
  220. Type GL_ACCT
  221.     GlId            As String * 8
  222.     GlAcct          As String * 12
  223.     GlName          As String * 30
  224.     GlType          As String * 2
  225.     GlParen         As Integer
  226.     GlMaster        As Integer
  227.     GlBalance       As Currency
  228.     GlSort          As String * 12
  229.     GlNoOfHist      As Long
  230. End Type
  231. Global ChartRec As GL_ACCT
  232. Global Const GlAcctLen = 80     ' length of the record
  233.  
  234. ' key specification used for creating files
  235. ' this is for 1 segment
  236. ' this sample program uses a file with 6 segments so
  237. ' this is not used here
  238. Type KEY_1SEG
  239.     KeyPos      As Integer
  240.     KeyLength   As Integer
  241.     KeyFlags    As Integer
  242.     ExtKeyType  As Integer
  243.     KeyNull     As Integer
  244. End Type
  245.  
  246. ' key specification used for creating files
  247. ' this is for 6 segments
  248. ' create additional key specifications depending on how many
  249. ' segments your files have
  250. Type KEY_6SEG
  251.     RecLen      As Integer
  252.     PgSize      As Integer
  253.     NoOfIndex   As Integer
  254.     NotUsed     As Long
  255.     FileFlags   As Integer
  256.     ResWrd      As Integer
  257.     Alloc       As Integer
  258.     KeyPos1     As Integer
  259.     KeyLen1     As Integer
  260.     KeyFlags1   As Integer
  261.     NotUsed1    As Long
  262.     Ext_Nul1    As Integer
  263.     ResWrd1     As Long
  264.     KeyPos2     As Integer
  265.     KeyLen2     As Integer
  266.     KeyFlags2   As Integer
  267.     NotUsed2    As Long
  268.     Ext_Nul2    As Integer
  269.     ResWrd2     As Long
  270.     KeyPos3     As Integer
  271.     KeyLen3     As Integer
  272.     KeyFlags3   As Integer
  273.     NotUsed3    As Long
  274.     Ext_Nul3    As Integer
  275.     ResWrd3     As Long
  276.     KeyPos4     As Integer
  277.     KeyLen4     As Integer
  278.     KeyFlags4   As Integer
  279.     NotUsed4    As Long
  280.     Ext_Nul4    As Integer
  281.     ResWrd4     As Long
  282.     KeyPos5     As Integer
  283.     KeyLen5     As Integer
  284.     KeyFlags5   As Integer
  285.     NotUsed5    As Long
  286.     Ext_Nul5    As Integer
  287.     ResWrd5     As Long
  288.     KeyPos6     As Integer
  289.     KeyLen6     As Integer
  290.     KeyFlags6   As Integer
  291.     NotUsed6    As Long
  292.     Ext_Nul6    As Integer
  293.     ResWrd6     As Long
  294. End Type
  295.  
  296.